// 根组件
import React from 'react'
import './App.scss'
import { Route, Switch, Redirect } from 'react-router-dom'
import Layout from './pages/Layout'
import Login from '@/pages/Login'
import Edit from '@/pages/Profile/Edit'

export default function App() {
  return (
    <div className="app">
      <Switch>
        {/* 方式一： */}
        {/* <Route path="/" exact>
          <Redirect to="/home"></Redirect>
        </Route> */}

        {/* 方式二：优势在于将来如果需要一定的逻辑判断 */}
        <Route
          path="/"
          exact
          render={() => {
            return <Redirect to="/home"></Redirect>
          }}
        ></Route>

        {/* 方式三：建议不用！！ */}
        {/* <Redirect path="/" exact to="/home"></Redirect> */}

        <Route path="/home" component={Layout}></Route>
        <Route path="/login" component={Login}></Route>
        <Route path="/profile/edit" component={Edit}></Route>
      </Switch>
    </div>
  )
}
